import socket
sk=socket.socket()
sk.bind(('127.0.0.1',9001))
sk.listen()
# print('sk:',sk)

while True:
    conn,addr=sk.accept()#和多个客户端连接
    print('conn:',conn)
    while True:
        send_msg=input('>>>')
        if send_msg.upper()=='Q':
            break
        conn.send(send_msg.encode('utf-8'))

        msg=conn.recv(1024).decode('utf-8')
        if msg.upper()=='Q':break
        print(msg)
    conn.close()













sk.close()


